// 定义 token 等的常量键名
const TokenKey = 'accessToken'
const RefreshToKenkey = 'refreshToken'

// 设置保存token 和refreshToken
export function setToken(token,refreshToken){
    localStorage.setItem(TokenKey,token)
    localStorage.setItem(RefreshToKenkey,refreshToken)
}

// 获取token
export function getToken(){
    return localStorage.getItem(TokenKey)
}

// 获取refreshToken
export function getRefreshToken(){
    return localStorage.getItem(RefreshToKenkey)
}

// 清除token和refreshToken
export function clearToken(){
    localStorage.removeItem(TokenKey)
    localStorage.removeItem(RefreshToKenkey)
}

// 判断有无登陆
export function isAuth(){
    let token = getToken()
    if(token){
        return true
    }else{
        return false
    }
}